package com.espeaker.sdk.api;

import android.os.Handler;

import com.espeaker.sdk.Constants;
import com.espeaker.sdk.ESpeakerParameters;

public class JiJingApi  extends MiaoApi {
	/*
	 * 获取最新一期机经
	 */
	public void getJijingLatest(final Handler handler)
	{
		new Thread() {
			@Override
			public void run() {
				try {
					ESpeakerParameters params = new ESpeakerParameters();
					params.add("user_id", "1",true);
					String mRes = request(MiaoApi.GetBaseURL(), JIJING_LATEST, params,1);
					if (handler != null) {
						handler.obtainMessage(Constants.JIJING_LATEST, mRes).sendToTarget();
					}
				} catch (Exception er) {
				}
			}
		}.start();
	}
	/*
	 * 获取往期机经
	 */
	public void getWangQi(final Handler handler)
	{
		new Thread() {
			@Override
			public void run() {
				try {
					ESpeakerParameters params = new ESpeakerParameters();
					params.add("user_id", "1",true);
					String mRes = request(MiaoApi.GetBaseURL(), JIJING_WANGQI, params,1);
					if (handler != null) {
						handler.obtainMessage(Constants.JIJING_WANGQI, mRes).sendToTarget();
					}
				} catch (Exception er) {
				}
			}
		}.start();
	}
	/*
	 * 获取一期机经
	 */
	public void getOnQi(final String qi_name,final Handler handler)
	{
		new Thread() {
			@Override
			public void run() {
				try {
					ESpeakerParameters params = new ESpeakerParameters();
					params.add("qi_name", qi_name,true);
					String mRes = request(MiaoApi.GetBaseURL(), JIJING_ONQI, params,1);
					if (handler != null) {
						handler.obtainMessage(Constants.JIJING_ONQI, mRes).sendToTarget();
					}
				} catch (Exception er) {
				}
			}
		}.start();
	}
	/*
	 * 获取一题机经
	 */
	public void getOnTi(final String title,final Handler handler)
	{
		new Thread() {
			@Override
			public void run() {
				try {
					ESpeakerParameters params = new ESpeakerParameters();
					params.add("title", title,true);
					String mRes = request(MiaoApi.GetBaseURL(), JIJING_ONTI, params,1);
					if (handler != null) {
						handler.obtainMessage(Constants.JIJING_ONTI, mRes).sendToTarget();
					}
				} catch (Exception er) {
				}
			}
		}.start();
	}
}
